
package com.be.beadmin.device.repository;

import com.be.beadmin.device.entity.InspectStandardCategory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @author zhouzhou
* @date 2023-09-19
**/
public interface InspectStandardCategoryRepository extends JpaRepository<InspectStandardCategory, String>, JpaSpecificationExecutor<InspectStandardCategory> {

    InspectStandardCategory findInspectStandardCategoryByIdAndDelete(String id, Integer delete);

    InspectStandardCategory findInspectStandardCategoryById(String id);


    @Query(value = "select distinct template_id from t_de_inspect_standard_category where is_delete=0", nativeQuery = true)
    List<String> findTemplateIds();

    @Query(value = "select distinct template_name from t_de_inspect_standard_category where template_id = ?1 and  is_delete=0", nativeQuery = true)
    String findTemplateNameById(String id);
}